Merge "Do not create new archive file names for old files"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 21 Mar 2019 22:45:50 +0000 (22:45 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 21 Mar 2019 22:45:50 +0000 (22:45 +0000)
includes/filerepo/file/LocalFile.php

index a3d1624..9b9e748 100644 (file)
@@ -1838,8 +1838,13 @@ class LocalFile extends File {
 
                $this->lock();
 
-               $archiveName = wfTimestamp( TS_MW ) . '!' . $this->getName();
-               $archiveRel = $this->getArchiveRel( $archiveName );
+               if ( $this->isOld() ) {
+                       $archiveRel = $dstRel;
+                       $archiveName = basename( $archiveRel );
+               } else {
+                       $archiveName = wfTimestamp( TS_MW ) . '!' . $this->getName();
+                       $archiveRel = $this->getArchiveRel( $archiveName );
+               }
 
                if ( $repo->hasSha1Storage() ) {
                        $sha1 = FileRepo::isVirtualUrl( $srcPath )